from selenium import webdriver
from time import sleep
from selenium.webdriver.common.by import By

class PackLogin():
    n = (By.ID, 'username')
    p = (By.ID, 'password')
    c = (By.ID, 'verify_code')
    b = (By.NAME, 'sbtbutton')
    def __init__(self,driver):
        self.driver=driver

    def login(self,name,passwd,code):#参数化
        self.driver.find_element(*self.n).send_keys(name)#账户
        self.driver.find_element(*self.p).send_keys(passwd)#密码
        self.driver.find_element(*self.c).send_keys(code)#验证码
        self.driver.find_element(*self.b).click()#确认